package com.relax.t1;

public class GetResult {
    private   int i;
    public int getI(){
        return i++;
    }

    public static void main(String[] args) {
        final GetResult getResult = new GetResult();
        new Thread(new Runnable() {
            public void run() {
                while (true){
                    System.out.println(Thread.currentThread()+"=="+getResult.getI());
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();

        new Thread(new Runnable() {
            public void run() {
                while (true){
                    System.out.println(Thread.currentThread()+"=="+getResult.getI());
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();


        new Thread(new Runnable() {
            public void run() {
                while (true){
                    System.out.println(Thread.currentThread()+"=="+getResult.getI());
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }
}
